package com.ruoyi.firefighterFire.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.firefighterFire.domain.FirefighterFire;
import com.ruoyi.firefighterFire.service.IFirefighterFireService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 灭火救援岗位技能科目项目Controller
 *
 * @author ruoyi
 * @date 2024-10-31
 */
@RestController
@RequestMapping("/system/FirefighterFire")
public class FirefighterFireController extends BaseController
{
    @Autowired
    private IFirefighterFireService firefighterFireService;

    /**
     * 查询灭火救援岗位技能科目项目列表
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:list')")
    @GetMapping("/list")
    public TableDataInfo list(FirefighterFire firefighterFire)
    {
        startPage();
        List<FirefighterFire> list = firefighterFireService.selectFirefighterFireList(firefighterFire);
        return getDataTable(list);
    }

    /**
     * 导出灭火救援岗位技能科目项目列表
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:export')")
    @Log(title = "灭火救援岗位技能科目项目", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FirefighterFire firefighterFire)
    {
        List<FirefighterFire> list = firefighterFireService.selectFirefighterFireList(firefighterFire);
        ExcelUtil<FirefighterFire> util = new ExcelUtil<FirefighterFire>(FirefighterFire.class);
        util.exportExcel(response, list, "灭火救援岗位技能科目项目数据");
    }

    /**
     * 获取灭火救援岗位技能科目项目详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(firefighterFireService.selectFirefighterFireById(id));
    }

    /**
     * 新增灭火救援岗位技能科目项目
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:add')")
    @Log(title = "灭火救援岗位技能科目项目", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FirefighterFire firefighterFire)
    {
        return toAjax(firefighterFireService.insertFirefighterFire(firefighterFire));
    }

    /**
     * 修改灭火救援岗位技能科目项目
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:edit')")
    @Log(title = "灭火救援岗位技能科目项目", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FirefighterFire firefighterFire)
    {
        return toAjax(firefighterFireService.updateFirefighterFire(firefighterFire));
    }

    /**
     * 删除灭火救援岗位技能科目项目
     */
    @PreAuthorize("@ss.hasPermi('system:FirefighterFire:remove')")
    @Log(title = "灭火救援岗位技能科目项目", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(firefighterFireService.deleteFirefighterFireByIds(ids));
    }
}
